package com.fengwk.cv4j.ind;

import org.junit.Test;
import org.nd4j.linalg.factory.Nd4j;

import com.fengwk.cv4j.factory.ind.INDViewFactory;
import com.fengwk.cv4j.view.View;
import com.fengwk.cv4j.view.ind.INDArrayWrap;

public class Mod {

	@Test
    public void test() {
        INDViewFactory f = new INDViewFactory();
        View<INDArrayWrap> W = f.of(Nd4j.create(new float[][] {
            {7, 0, 9},
            {0.55f, 113, 12}
        }));
        View<INDArrayWrap> X = f.of(Nd4j.create(new float[][] {
            {1, 3, 3},
            {0.48f, 35, 6}
        }));
        
        View<INDArrayWrap> mod = f.mod(W, X);
        View<INDArrayWrap> d_mod_W = mod.gradient(W);
        View<INDArrayWrap> d_mod_X = mod.gradient(X);
        
        System.out.println("------mod------");
        System.out.println(mod.compute());
        System.out.println("------d_mod_W------");
        System.out.println(d_mod_W.compute());
        System.out.println("------d_mod_X------");
        System.out.println(d_mod_X.compute());
	}
	
}
